<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Model\Repair
 *
 * @property integer $id
 * @property string $open_id
 * @property integer $platform 机器类型 0-PC 1-手机
 * @property string $description 描述
 * @property integer $status 0-未跟进 1-已联系 2-已解决 3-不解决
 * @property integer $operator_id
 * @property \Carbon\Carbon $created_at
 * @property \Carbon\Carbon $updated_at
 * @property string $deleted_at
 * @property-read \App\Model\User $user
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereOpenId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair wherePlatform($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereDescription($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereStatus($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereOperatorId($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereCreatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereDeletedAt($value)
 * @mixin \Eloquent
 * @property-read \App\Model\Schedule $schedule
 * @property string $order_time
 * @property integer $schedule_id
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereOrderTime($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Model\Repair whereScheduleId($value)
 */
class Repair extends Model
{
    protected $table = 'repair_order';

    protected $guarded = [];
    protected $hidden = [
        'open_id',
        'schedule_id',
        'deleted_at',
    ];

    public function user()
    {
        return $this->belongsTo('App\Model\User', 'open_id', 'open_id');
    }

    public function schedule()
    {
        return $this->belongsTo('App\Model\Schedule', 'schedule_id', 'id');
    }

    public function operator()
    {
        return $this->belongsTo('App\Model\Admin', 'operator_id', 'id');
    }
}
